<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../../../../assets/libs/jquery/jquery-3.6.1.min.js"></script>
</head>

<body>
  <div></div>

  <script>
    // add
    $('div').addClass('my-class')

    // remove
    $('div').removeClass('my-class')

    // toggle
    $('div').toggleClass('my-class')

    // 是否包含某个类名
    console.log($('div').hasClass('my-class'))
  </script>
</body>

</html>